# -*- coding: utf-8 -*-
"""
Created on Mon Oct 17 22:39:30 2016

@author: zhiqiang
"""
import time
on = time.time()

from math import sqrt
n3 = 144
while True:
    test = n3*(2*n3-1)
    is_tri = False
    for may_n1 in range(int(sqrt(2*test)),int(sqrt(2*test))+2):
        if may_n1*(may_n1+1)//2==test:
            is_tri = True
            n1 = may_n1
            break
    is_allright = False
    if is_tri:
        for may_n2 in range(n3+1,min((n1,int(sqrt(test))+2))):
            if may_n2*(3*may_n2-1)//2<test:
                continue
            elif may_n2*(3*may_n2-1)//2==test:
                is_allright=True
                print(test)
                break
            else:
                break
    if is_allright:
        break
    else:
        n3 += 1
print(time.time()-on)